package cn.dust.design.pattern.structural.composite.Military;

import java.util.Iterator;
import java.util.LinkedList;

public class MilitaryOfficer extends MilitaryPerson{
	
	private LinkedList<MilitaryPerson> children;
	
	public MilitaryOfficer(String name, double salary) {
		super(name, salary);
		children = new LinkedList<MilitaryPerson>();
	}

	@Override
	public void add(MilitaryPerson person) {
		children.add(person);
		
	}

	@Override
	public void remove(MilitaryPerson person) {
		children.remove(person);
		
	}

	@Override
	public MilitaryPerson getChild(int index) {
		return children.get(index);
	}

	@Override
	public Iterator<MilitaryPerson> getAllChildren() {
		Iterator<MilitaryPerson> it = children.iterator();
		return it;
	}

	@Override
	public boolean isLeaf() {
		return false;
	}
	
	

}
